home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 686 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. From: alice yang <aliceyang@worldnet.att.net>
  2. Message-ID: <30F54E6D.B4@worldnet.att.net>
  3. X-Original-Date: Thu, 11 Jan 1996 09:52:45 -0800
  4. Path: in2.uu.net!bounce-back
  5. Date: 12 Mar 96 02:11:44 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: static_cast
  9. Organization: AT&T WorldNet Services
  10. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMUTdguEDnX0m9pzZAQECNQGAg8eaCxlWMPMqNYjVeKKkjXFHQflS8Guc
  13.     ug07iYHd9CYt74YfnZKTQw/6nLEDL9ie
  14.     =uR+/
  15.  
  16. C++ Guru
  17.  Would you help me to understand the importance of using "static-cast"?
  18.  
  19. In the book, it states, "this cast construct is a better alternative than its 
  20. c counterpart only becasue it is easier to locate a c++ cast construct in a 
  21. source file"
  22.  
  23. So, does that mean the following is exactly the same?
  24.  
  25. float fnumber;
  26. int   inumber;
  27.  
  28. fnumber=(float)inumber;
  29. fnumber=<static_cast>inumber; /same as the first one??/
  30. ---
  31. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  32. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  33. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  34. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  35. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  36.